#if !defined(__app_serial_h)
#define __app_serial_h

#include <termios.h>
#include "app_device.h"

// 波特率
typedef enum {
    BR_9600 = B9600,
    BR_115200 = B115200
} BaudRate;

// 验证位
typedef enum {
    Parity_NONE = 0,
    Parity_ODD = PARENB | PARODD, 
    Parity_EVEN = PARENB, 
} Parity;

// 停止位
typedef enum {
    SB_1 = 0,
    SB_2 = CSTOPB
} StopBits;

int app_serial_setBaudRate(Device_t *device, BaudRate rate);

int app_serial_setParity(Device_t *device, Parity parity);

int app_serial_setStopBits(Device_t *device, StopBits stopBits);

int app_serial_setBlock(Device_t *device, int is_block);

int app_serial_setRaw(Device_t *device);

int app_serial_init(Device_t *device);

int app_serial_flush(Device_t *device);


#endif // __APP_SERIAL_H
